[BITS 32]
[SECTION .text]

; <summary>
; int nlGetProcessorCount(void);
; </summary>
[GLOBAL nlGetProcessorCount]
nlGetProcessorCount:
	push ebp
	mov ebp, esp
	mov eax, 1
	cpuid
    mov eax, ebx
	shr eax, 10h
	and eax, 0FFh
	pop ebp
	ret

; <summary>
; unsigned int GetProcessorFeatures(void);
; </summary>
[GLOBAL nlGetProcessorFeatures]
nlGetProcessorFeatures:
	push ebp
	mov ebp, esp
	sub	esp, 4
	mov	DWORD [ebp-4], 0
	mov eax, 1
	cpuid
	
    mov eax, edx
	and eax, 0x800000 
	je jump1
	or DWORD [ebp-4], 0x10
	jump1:
	
	mov eax, edx
	and eax, 0x2000000 
	je jump2
	or DWORD [ebp-4], 0x20
	jump2:
	
	mov eax, edx
	and eax, 0x4000000 
	je jump3
	or DWORD [ebp-4], 0x40
	jump3:
	
	mov eax, ecx
	and eax, 0x1
	je jump4
	or DWORD [ebp-4], 0x80
	jump4:

	mov eax, DWORD [ebp-4]
	leave
	ret
